﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Data.SqlClient;
using System.Configuration;

namespace Mobile.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult About()
        {
            return View();
        }

        public ActionResult LoginAction()
        {
            return View();
        }

        public ActionResult HostAction()
        {
            return View();
        }

        private string GetPartyID(string accessCode)
        {
            SqlDataReader reader;
            try
            {
                SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["NextrackConn"].ConnectionString);
                myConnection.Open();

                //Get ID
                using (SqlCommand command = new SqlCommand("SELECT FROM Parties Where Access_Code=@Access_Code", myConnection))
                {
                    command.Parameters.Add(new SqlParameter("Access_Code", accessCode));
                    reader = command.ExecuteReader();

                    reader.Read();
                    return reader["Party_ID"].ToString();
                }
            }
            catch (Exception ex)
            {
                return null;
            }
        }

    }
}
